/* 
 * Copyright (c)	Insighten Intelligent Equipment co.,LTD
 * 
 *  Use of this software is controlled by the terms and conditions found
 *  in the license agreement under which this software has been supplied.
 * 
 */
/** 
 * @file cmsgcli_main.c
 * @brief test for share memory and message queue
 * @author taco [tacoee@gmail.com]
 * @version 0.1
 * @date 2010-09-15
 */
#include <ctype.h>

#include "types.h"
#include "rwbuf.h"
#include "communication.h"
#include "cmsg.h"

int upper_string(RwBuf **in, RwBuf **out, MsgCmd cmd)
{
	return_val_if_fail(in != NULL, -1);
	int i;
	RwBuf *inp;

	inp= (RwBuf *)*in;

	dbg_log("mem_wpos= %d", inp->wpos);
	for(i=0; i<inp->wpos; i++) {
		*(inp->mem+i) = toupper(*(inp->mem+i));
	}

	*out = *in;
	dbg_log("finished");

	return 0;
}

int main(int argc, char *argv[])
{
	CommObj *cobj = NULL;

	cobj = comm_obj_open(cobj, MSG_KEY_G, SHM_KEY_G, SHM_SIZE); 

	comm_obj_set_msg_type(cobj, MSG_TYPE_CLI, MSG_TYPE_OSD);

	comm_obj_rcv_snd(cobj, upper_string);

	comm_obj_destory(cobj); /*don't destory deeply, because server need share memory*/

	return 0;
}
